﻿using Microsoft.AspNetCore.Mvc;
using Sys.Core.Models.Queries;
using Sys.Core.Models.VO;
using Sys.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MiniFox.Web.Infrastructure;
using MiniFox.Web.Filters;
using MiniFox.Platform.Applications.Web;
using MiniFox.Infrastructure;
using MiniFox.Utility;

namespace Sys.Controllers
{
    [NoCache, ValidationFilter, Area(GlobalConstants.AREA_NAME)]
    public class MailController : AuthorizedController<IDispatcherService>
    {
        [HttpPost]
        public Response<ResultObject<IEnumerable<MailSentItemVo>>> Sentlist([FromBody] PagedQueryObject<MailQuery> request)
        {
            var result = this.Component.SentQuery(request);
            return result.CreateResponse();
        }

        [HttpGet]
        public Response<MailSentItemVo> SentItem([FromQuery] string messageId)
        {
            MailSentItemVo result = this.Component.SentItem(messageId);
            return result.CreateResponse();
        }

        [HttpPost]
        public Response<ResultObject<IEnumerable<MailFailItemVo>>> Faillist([FromBody] PagedQueryObject<MailQuery> request)
        {
            var result = this.Component.FailQuery(request);
            return result.CreateResponse();
        }

        [HttpGet]
        public Response<MailFailItemVo> FailItem([FromQuery] string messageId)
        {
            MailFailItemVo result = this.Component.FailItem(messageId);
            return result.CreateResponse();
        }

    }
}
